package net.fivegoods.entity.impl.slim3;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2011-03-20 23:13:45")
/** */
public final class VolunteerModelMeta extends org.slim3.datastore.ModelMeta<net.fivegoods.entity.impl.slim3.VolunteerModel> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<net.fivegoods.entity.impl.slim3.VolunteerModel> guid = new org.slim3.datastore.StringAttributeMeta<net.fivegoods.entity.impl.slim3.VolunteerModel>(this, "guid", "guid");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<net.fivegoods.entity.impl.slim3.VolunteerModel, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<net.fivegoods.entity.impl.slim3.VolunteerModel, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<net.fivegoods.entity.impl.slim3.VolunteerModel> name = new org.slim3.datastore.StringAttributeMeta<net.fivegoods.entity.impl.slim3.VolunteerModel>(this, "name", "name");

    private static final VolunteerModelMeta slim3_singleton = new VolunteerModelMeta();

    /**
     * @return the singleton
     */
    public static VolunteerModelMeta get() {
       return slim3_singleton;
    }

    /** */
    public VolunteerModelMeta() {
        super("VolunteerModel", net.fivegoods.entity.impl.slim3.VolunteerModel.class);
    }

    @Override
    public net.fivegoods.entity.impl.slim3.VolunteerModel entityToModel(com.google.appengine.api.datastore.Entity entity) {
        net.fivegoods.entity.impl.slim3.VolunteerModel model = new net.fivegoods.entity.impl.slim3.VolunteerModel();
        model.setGuid((java.lang.String) entity.getProperty("guid"));
        model.setKey(entity.getKey());
        model.setName((java.lang.String) entity.getProperty("name"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        net.fivegoods.entity.impl.slim3.VolunteerModel m = (net.fivegoods.entity.impl.slim3.VolunteerModel) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("guid", m.getGuid());
        entity.setProperty("name", m.getName());
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        net.fivegoods.entity.impl.slim3.VolunteerModel m = (net.fivegoods.entity.impl.slim3.VolunteerModel) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        net.fivegoods.entity.impl.slim3.VolunteerModel m = (net.fivegoods.entity.impl.slim3.VolunteerModel) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        throw new IllegalStateException("The version property of the model(net.fivegoods.entity.impl.slim3.VolunteerModel) is not defined.");
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        net.fivegoods.entity.impl.slim3.VolunteerModel m = (net.fivegoods.entity.impl.slim3.VolunteerModel) model;
        writer.beginObject();
        org.slim3.datastore.json.JsonCoder encoder = null;
        if(m.getGuid() != null){
            writer.setNextPropertyName("guid");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getGuid());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getKey());
        }
        if(m.getMissionsRef() != null){
            writer.setNextPropertyName("missionsRef");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getMissionsRef());
        }
        if(m.getName() != null){
            writer.setNextPropertyName("name");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getName());
        }
        writer.endObject();
    }

    @Override
    protected net.fivegoods.entity.impl.slim3.VolunteerModel jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        net.fivegoods.entity.impl.slim3.VolunteerModel m = new net.fivegoods.entity.impl.slim3.VolunteerModel();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.JsonCoder decoder = null;
        reader = rootReader.newObjectReader("guid");
        decoder = new org.slim3.datastore.json.Default();
        m.setGuid(decoder.decode(reader, m.getGuid()));
        reader = rootReader.newObjectReader("key");
        decoder = new org.slim3.datastore.json.Default();
        m.setKey(decoder.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("missionsRef");
        decoder = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("name");
        decoder = new org.slim3.datastore.json.Default();
        m.setName(decoder.decode(reader, m.getName()));
        return m;
    }
}